home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-07 | 1.9 KB | 79 lines | [TEXT/MPS ] |
- (*
- CTBKill [inOutBoth] -- Kill pending communication on the input (inOutBoth = "in"), output
- (inOutBoth = "out") or both (inOutBoth = "both"). The default is "both".
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w CTBKill.p
- link -m ENTRYPOINT -o HyperCommands -rt XCMD=2762 -sn Main=CTBKill ∂
- CTBKill.p.o "{MPW}"Libraries:interface.o "{MPW}"Libraries:Libraries:HyperXLib.o
-
- © Copyright 1990 by Apple Computer, Inc.
-
- Initial coding 2/90 by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S CTBKill } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, ToolIntf, CTBUtils, FTIntf, CMIntf, TMIntf, CRMIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- procedure CTBKill(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- CTBKill(paramPtr);
- end;
-
- procedure CTBKill(paramPtr: XCmdPtr);
-
- {$I CTBUtil.inc}
-
- var ch: Char;
- killInput, killOutput: boolean;
- dummy: CMErr;
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
- exit(CTBKill);
- end;
-
- begin
- { Check the parameter count. }
- if paramPtr^.paramCount > 1 then Fail('Invalid parameter count');
-
- { Figure out what we're supposed to kill. }
- killInput := true;
- killOutput := true;
- if ParmPresent(1) then
- begin
- ch := Chr(paramPtr^.params[1]^^);
- if (ch = 'i') or (ch = 'I') then killOutput := false
- else if (ch = 'o') or (ch = 'O') then killInput := false;
- end;
-
- { Make sure the Comm Toolbox is here. }
- CTBReady;
- { And a connection tool is present. }
- EnsurePresent(connectionTool);
- { And the connection is open. }
- EnsureOpen;
-
- { kill kill kill kill Kill KIll KILl KILL KILL KILL KILL !!!!!! }
- if killInput then dummy := CMIOKill(Globals^^.connHand,ord(cmDataIn));
- if killOutput then dummy := CMIOKill(Globals^^.connHand,ord(cmDataOut));
- end;
-
- end.
-